package com.lsh.payment.data;

import com.lsh.payment.data.service.PaymentSyncService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Project Name: lsh-payment
 * Created by peter on 16/11/14.
 * 北京链商电子商务有限公司
 * Package
 * desc:
 */
public class PaymentMain {


    public static void main(String[] args) {

        Logger logger = LoggerFactory.getLogger(PaymentMain.class);

        ApplicationContext context = new ClassPathXmlApplicationContext("classpath:META-INF/spring/payment-data.xml");
        PaymentSyncService paymentSyncService = context.getBean("paymentSyncService", PaymentSyncService.class);

        String flag = null;
        int time = 0;

        if (args != null && args.length == 2) {
            /**
             * 参数设置,
             * flag:b-before a-after
             * time:时间戳(php)
             */
            flag = args[0];
            time = Integer.parseInt(args[1]);
            logger.info("args:" + args[0] + " " + args[1]);
        }



        logger.info("payment data start ...");
        paymentSyncService.selectPayMainForSync(flag, time);
        logger.info("payment data end ...");
    }
}
